package com.xsmart.oa.api;

import com.xsmart.common.entity.RequestBean;
import com.xsmart.oa.services.ShopManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 *商店管理
 * @author lxh
 * @date 2018/1/5
 */
@Controller
@RequestMapping("/api")
public class ShopManageController {
    @Autowired
    ShopManageService shopManageService;

    /**
     * 查询所有的商家信息
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/queryAllSeller",method = RequestMethod.POST)
    @ResponseBody
    public Object queryAllSeller(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.queryAllSeller(requestBean);
    }

    /**
     * 更新对应的商家信息
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/updateSeller",method = RequestMethod.POST)
    @ResponseBody
    public Object updateSeller(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.updateSeller(requestBean);
    }

    /**
     * 查询店铺对应的货物
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/queryShopGoodById",method = RequestMethod.POST)
    @ResponseBody
    public Object queryShopGoodById(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.queryShopGoodById(requestBean);
    }
    /**
     * 查询s所有货物
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/queryAllGoods",method = RequestMethod.POST)
    @ResponseBody
    public Object queryAllGoods(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.queryAllGoods(requestBean);
    }
    /**
     * 更新对应店铺的货物
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/insertShopGoods",method = RequestMethod.POST)
    @ResponseBody
    public Object insertShopGoods(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.insertShopGoods(requestBean);
    }
    /**
     * 删除对应店铺的货物
     * @param requestBean
     * @param httpServletRequest
     * @return
     */
    @RequestMapping(value="/v1/ShopManage/deleteShopGoods",method = RequestMethod.POST)
    @ResponseBody
    public Object deleteShopGoods(@ModelAttribute RequestBean requestBean, HttpServletRequest httpServletRequest){
        return  shopManageService.deleteShopGoods(requestBean);
    }
}
